/**      
 * @file		Square.cpp
 * @description		This example demonstrates how a class my use
 *			a struct array. So what is the base type of points?
 * @course		CSCI 123 Section 00000
 * @assignment 
 * @date		mm/dd/yyyy
 * @author		Brad Rippe (00000000) brippe@fullcoll.edu
 * @version		1.0
 */
#include <iostream>
using namespace std;

struct Point {
	int x;
	int y;
};

class Square {
public:
	// static keywords defines the const var
	// as being a member of the class Square
	// and not one instance
	static const int MAX_POINTS = 4;
	friend istream& operator >>(istream& aInput, Square& aSquare);
	friend ostream& operator <<(ostream& aOutput, const Square& aSquare);
private:
	Point mPoints[MAX_POINTS];
};

/**
 * @return zero if the application executes successfully
 */
int main() {
	Square square;
	cout << "Please type the x and y coordinates of four points ";
	cout << "of a square.\n";
	cin >> square;
	cout << "Outputting your square:\n";
	cout << square << endl;
	return 0;
}

istream& operator >>(istream& aInput, Square& aSquare) {
	for(int i = 0; i < Square::MAX_POINTS; i++) {
		aInput >> aSquare.mPoints[i].x;
		aInput >> aSquare.mPoints[i].y;
	}
	return aInput;
}

ostream& operator <<(ostream& aOutput, const Square& aSquare) {
	for(int i = 0; i < Square::MAX_POINTS; i++) {
		aOutput << "Point " << (i+1) << endl;
		aOutput << "\t" << aSquare.mPoints[i].x << ", ";
		aOutput << aSquare.mPoints[i].y << endl;
	}
	return aOutput;
}

